package com.example.ioc.component;


import com.example.ioc.model.UserInfo;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class UserComponent {
    //指定当前要注入的bean对象
//    @Qualifier("userInfo")
//    @Autowired
    @Resource(name = "userInfo")
    private UserInfo userInfo;
    public void sayhi(){
        System.out.println("hi,Component");
        System.out.println(userInfo);
    }
}
